//
//  InternetbankViewController.m
//  项目三
//
//  Created by rimi on 15/9/28.
//  Copyright (c) 2015年 rimi. All rights reserved.
//

#import "InternetbankViewController.h"
#import "WebViewController.h"

@interface InternetbankViewController ()
- (void)initializeUserInterface; /**< 初始化用户界面 */

@end

@implementation InternetbankViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeUserInterface];
}

- (void)initializeUserInterface {
    self.titleImageView.image = [UIImage imageNamed:@"图标-我的网银"];
    [super initializeUserInterface];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setFrame:DHFlexibleFrame(CGRectMake(47, 100, 616, 382))];
    [btn setBackgroundImage:[UIImage imageNamed:@"我的银行1"] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:@"我的银行1"] forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(respondsToBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:DHFlexibleFrame(CGRectMake(47, 540, 603, 375))];
    imageView.image = [UIImage imageNamed:@"我的银行2"];
    [self.view addSubview:imageView];
}

- (void)respondsToBtn:(UIButton *)sender {
    
    WebViewController *webVC = [[WebViewController alloc] init];
    CATransition *transition = [CATransition animation];
    
    transition.duration = 0.3f;
    
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    
    transition.type = kCATransitionReveal;
    
    transition.subtype = kCATransitionFromLeft;
    
    transition.delegate = self;
    [[[ControllerManager sharedManager] viewController].view.layer addAnimation:transition forKey:nil];
    
    [[[ControllerManager sharedManager] viewController].view addSubview:webVC.view];
}
@end
